package com.example.admin.controller;

import com.example.admin.Dto.CheckInConfigDto;
import com.example.admin.Dto.CheckInDto;
import com.example.admin.Dto.CheckInReviewDto;
import com.example.admin.Dto.SignDto;
import com.example.admin.Vo.CheckInVo;
import com.example.admin.base.ResponseResult;
import com.example.admin.service.CheckInservice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
public class CheckIncon {
    /**
     * 提交入住申请接口
     */
    @Autowired
    CheckInservice checkInservice;
  @PostMapping("/checkIn/create")
    public ResponseResult createCheckIn(@RequestBody CheckInDto checkInDto) {
      try {
          checkInservice.createCheckIn(checkInDto);
          return ResponseResult.success();
      } catch (Exception e) {
          return ResponseResult.error(e.getMessage());
      }
  }
@GetMapping("/checkIn")
  public ResponseResult checkIndetail(String assigneeid,String code,Integer flowStatus,String taskid){
      CheckInVo checkInVo = checkInservice.checkIndetail(assigneeid,code,flowStatus,taskid);
      return ResponseResult.success(checkInVo);
  }
@PostMapping("/checkIn/review")
 public ResponseResult checkInReview(@RequestBody CheckInReviewDto checkInReviewDto){
       checkInservice.checkInReview(checkInReviewDto);
       return ResponseResult.success();
 }
@PutMapping("/checkIn/submit")
 public ResponseResult checkSubmit(Long id,String message,String taskId){
        checkInservice.checkSubmit(id,message,taskId);
        return ResponseResult.success();
 }
 @PutMapping("/checkIn/reject")
 public ResponseResult checkReject(Long id,String message,String taskId){
      checkInservice.checkReject(id,message,taskId);
      return ResponseResult.success();
 }
 @PutMapping("/checkIn/rebut")
 public ResponseResult rebut(Long id,String message,String taskId){
      checkInservice.rebut(id,message,taskId);
      return ResponseResult.success();
 }
@PostMapping("/checkIn")
 public ResponseResult checkinconfig(@RequestBody CheckInConfigDto checkInConfigDto){
    checkInservice.checkinconfig(checkInConfigDto);
    return ResponseResult.success();
 }

 public ResponseResult sign(@RequestBody SignDto signDto){
      checkInservice.sign(signDto);
      return ResponseResult.success();
 }
}
